<%--
  Created by IntelliJ IDEA.
  User: FX95
  Date: 2022/11/18
  Time: 9:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">

</head>
<body>
<input style="float: right;" type="button" class="btn btn-success btn-s-xs" onclick="chiody()" id="id1" value="打印"/>

<h1  align="center">总括订单</h1>
 <form id="select" >
     <table align="center" class="table table-striped" border="1" cellspacing="0" width="100%">
         <tr class="warning">
             <th>序号</th>
             <th>菜名</th>
             <th>分量</th>
         </tr>
         <c:forEach items="${orderItems}" var="orderItem" varStatus="status">


                 <tr class="active">
                     <td width="5%">${status.count}</td>
                     <td width="15%">${orderItem.goodsName}</td>
                     <td width="5%">${orderItem.count}份</td>
                 </tr>

         </c:forEach>



     </table>
 </form>
<script>

    function chiody() {
        //来个网页提示
        if (confirm('确认打印吗？')){
            //隐藏不需要打印的内容，上面的id在这块就被用到了
            document.getElementById('id1').style.display="none";

            //执行打印方法，建议Chrome，可以预览打印内容
            window.print();
            //放开隐藏的内容
            document.getElementById('id1').style.display="inline";
        }
    }

</script>
</body>
</html>
